/*
 * Copyright (C) 2007-2012 by XDEV Software, All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 3.0 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
package xdev.db;


/**
 * The representation of a savepoint, which is a point within the current
 * transaction that can be referenced from the {@link DBConnection#rollback()}
 * method. When a transaction is rolled back to a savepoint all changes made
 * after that savepoint are undone.
 * <p>
 * Savepoints can be either named or unnamed. Unnamed savepoints are identified
 * by an ID generated by the underlying data source.
 * 
 * @author XDEV Software
 */
public interface Savepoint
{
	/**
	 * Retrieves the generated ID for the {@link Savepoint} that this
	 * {@link Savepoint} object represents.
	 * 
	 * @return the numeric ID of this {@link Savepoint}
	 * 
	 * @throws DBException
	 *             if this is a named {@link Savepoint}
	 */
	public int getSavepointId() throws DBException;


	/**
	 * Retrieves the name of the {@link Savepoint} that this {@link Savepoint}
	 * object represents.
	 * 
	 * @return the name of this {@link Savepoint}
	 * 
	 * @throws DBException
	 *             if this is an un-named {@link Savepoint}
	 */
	public String getSavepointName() throws DBException;
}
